# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=perl-math-pari
_pkgname=Math-Pari
pkgver=2.030528
pkgrel=2
epoch=4
pkgdesc='Perl interface to PARI.'
arch=('x86_64' 'aarch64')
url='https://metacpan.org/pod/Math::Pari'
license=('Artistic-1.0-Perl' 'GPL-2.0-or-later')
depends=('perl')
options=(!emptydirs)
source=("https://cpan.metacpan.org/authors/id/I/IL/ILYAZ/modules/$_pkgname-$pkgver.tar.gz"
        "pari-2.3.5.patch")
sha512sums=('a07e3b907f3cbb9b82f6bacfbdae8813a2a9f2eb89d571bd37b67528c01b16d92156b06412d12ad7007c568a921deca70a8e7092a5e7c5403985df620048bd34'
            '7371e3cc38ca4f624dfa6436c0c0280486c6fcdba37e65cf720a9afac04f49e401873a9fa5b1c914547ad515983672a0e43590e0afee8a3dcb1b3552144a2831')
_distdir="$_pkgname-$pkgver"

build() {
  ( export PERL_MM_USE_DEFAULT=1 PERL5LIB=""                 \
    PERL_AUTOINSTALL=--skipdeps                            \
    PERL_MM_OPT="INSTALLDIRS=vendor DESTDIR='$pkgdir'"     \
    PERL_MB_OPT="--installdirs vendor --destdir '$pkgdir'" \
    MODULEBUILDRC=/dev/null

    cd $_distdir

    /usr/bin/perl Makefile.PL

    patch -p1 < ../pari-2.3.5.patch

    make
  )
}

package() {
  cd $_distdir

  make install

  find "$pkgdir" -name .packlist -o -name perllocal.pod -delete
}

